<template>
  <div class="city">
    <div class="header">
      <van-nav-bar
        title="所在城市"
        left-text="返回首页"
        left-arrow
        @click-left="$router.push('/home')"
      >
        <template #left>
          <van-icon name="arrow-left" size="25" color="black" />
        </template>
      </van-nav-bar>
    </div>
    <div class="main">
      <div @click="choiceCity">请选择城市</div>
      <div>按字母选择</div>
    </div>
    <div class="bottom">
      <div class="mainOne" v-show="flag">111</div>
      <div class="mainTwo" v-show="!flag">222</div>
    </div>
  </div>
</template>

<script>
import axios from "axios";
// import { getCity } from "../../api/city";
export default {
  data() {
    return {
      flag: true,
    };
  },
  methods: {
    choiceCity() {
      //   getCity().then((res) => {
      //     console.log(res);
      //   });
      axios.get("city/city.json").then((res) => {
        console.log(res);
      });
    },
  },
};
</script>

<style scoped>
.city {
  background-color: #ccc;
  height: 100%;
}
.main {
  display: flex;
  justify-content: space-around;
  text-align: center;
}
.main div {
  width: 1.2rem;
  height: 0.3rem;
  background-color: palevioletred;
  line-height: 0.3rem;
}
.mainOne {
  width: 0.8rem;
  height: 0.4rem;
  background-color: hotpink;
  text-align: center;
  line-height: 0.4rem;
  margin: 5px;
}
.mainTwo {
  width: 0.8rem;
  height: 0.4rem;
  background-color: hotpink;
  text-align: center;
  line-height: 0.4rem;
  margin: 5px;
}
.bottom {
  display: flex;
}
</style>